/*
 * @Author: boboan 360969885@qq.com
 * @Date: 2022-07-29 18:55:41
 * @LastEditors: boboan 360969885@qq.com
 * @LastEditTime: 2022-07-29 19:05:44
 * @FilePath: /react-vite-template/src/pages/p-cnpc/services/a.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export const TYPES = {
    'TOKEN_INVALID': 401,
    'NEED_LOGIN': 524,
    // 'NEED_LOGIN1': 601,
    'NEED_LOGIN2': 509
}

export default function httpErrorHandler({ code }: CNPC.Res.data<any>) {
    switch (code) {
        case TYPES.NEED_LOGIN: // 524
            console.log('重新登陆')
            window.rvtBridge.toLogin();break
        case TYPES.NEED_LOGIN2: // 509
            console.log('重新登陆')
            window.rvtBridge.toLogin(); break;
        case TYPES.TOKEN_INVALID: // 401
            console.log('重新登陆')
            window.rvtBridge.toLogin(); break;
    }
}

httpErrorHandler.TYPES = TYPES